gdk: Remove DRAG_STATUS and DROP_FINISHED events
authorBenjamin Otte <otte@redhat.com>
Fri, 15 Dec 2017 21:54:34 +0000 (22:54 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 15 Dec 2017 22:48:36 +0000 (23:48 +0100)
Those are source-side events that are handled by signals of the
Dragontext these days.

gdk/gdkevents.c
gdk/gdkevents.h
gdk/gdkeventsprivate.h
gdk/gdkwindow.c
gdk/wayland/gdkdnd-wayland.c
gdk/x11/gdkdnd-x11.c
gtk/gtkmain.c
gtk/gtkwidget.c

index 0e67160c695fa176c4731fc61033fe597f73672e..ab641ba6c67da2275fc0f8a6e980239ab474e9c5 100644 (file)
@@ -645,9 +645,7 @@ gdk_event_copy (const GdkEvent *event)
     case GDK_DRAG_ENTER:
     case GDK_DRAG_LEAVE:
     case GDK_DRAG_MOTION:
-    case GDK_DRAG_STATUS:
     case GDK_DROP_START:
-    case GDK_DROP_FINISHED:
       g_object_ref (event->dnd.context);
       break;
 
@@ -733,9 +731,7 @@ gdk_event_finalize (GObject *object)
     case GDK_DRAG_ENTER:
     case GDK_DRAG_LEAVE:
     case GDK_DRAG_MOTION:
-    case GDK_DRAG_STATUS:
     case GDK_DROP_START:
-    case GDK_DROP_FINISHED:
       if (event->dnd.context != NULL)
         g_object_unref (event->dnd.context);
       break;
@@ -842,9 +838,7 @@ gdk_event_get_time (const GdkEvent *event)
       case GDK_DRAG_ENTER:
       case GDK_DRAG_LEAVE:
       case GDK_DRAG_MOTION:
-      case GDK_DRAG_STATUS:
       case GDK_DROP_START:
-      case GDK_DROP_FINISHED:
        return event->dnd.time;
       case GDK_PAD_BUTTON_PRESS:
       case GDK_PAD_BUTTON_RELEASE:
@@ -930,9 +924,7 @@ gdk_event_get_state (const GdkEvent        *event,
       case GDK_DRAG_ENTER:
       case GDK_DRAG_LEAVE:
       case GDK_DRAG_MOTION:
-      case GDK_DRAG_STATUS:
       case GDK_DROP_START:
-      case GDK_DROP_FINISHED:
       case GDK_NOTHING:
       case GDK_DELETE:
       case GDK_DESTROY:
@@ -1077,9 +1069,7 @@ gdk_event_get_root_coords (const GdkEvent *event,
     case GDK_DRAG_ENTER:
     case GDK_DRAG_LEAVE:
     case GDK_DRAG_MOTION:
-    case GDK_DRAG_STATUS:
     case GDK_DROP_START:
-    case GDK_DROP_FINISHED:
       x = event->dnd.x_root;
       y = event->dnd.y_root;
       break;
@@ -2115,9 +2105,7 @@ gdk_event_get_drag_context (const GdkEvent  *event,
   if (event->any.type == GDK_DRAG_ENTER ||
       event->any.type == GDK_DRAG_LEAVE ||
       event->any.type == GDK_DRAG_MOTION ||
-      event->any.type == GDK_DRAG_STATUS ||
-      event->any.type == GDK_DROP_START ||
-      event->any.type == GDK_DROP_FINISHED)
+      event->any.type == GDK_DROP_START)
     {
       *context = event->dnd.context;
       return TRUE;
index c4e70c81b6545b06ad8d7ff058c8a2448e5de1b6..01d0416f93d35366dfdbf3ddfbf540e0ce0cbd58 100644 (file)
@@ -239,10 +239,7 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  * @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
  * @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
  *   progress.
- * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
- *   has changed.
  * @GDK_DROP_START: a drop operation onto the window has started.
- * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
  * @GDK_SCROLL: the scroll wheel was turned
  * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
  *   was added in 2.8.
@@ -298,9 +295,7 @@ typedef enum
   GDK_DRAG_ENTER,
   GDK_DRAG_LEAVE,
   GDK_DRAG_MOTION,
-  GDK_DRAG_STATUS,
   GDK_DROP_START,
-  GDK_DROP_FINISHED,
   GDK_SCROLL,
   GDK_GRAB_BROKEN,
   GDK_TOUCH_BEGIN,
index cf582314bb75904002a471d31e4001c4f0aa3ff4..001e20b36ac67441a89cafbd376f98545ff93f7c 100644 (file)
@@ -436,8 +436,7 @@ struct _GdkEventGrabBroken {
 /**
  * GdkEventDND:
  * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
- *   %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
- *   %GDK_DROP_FINISHED).
+ *   %GDK_DRAG_MOTION or %GDK_DROP_START)
  * @window: the window which received the event.
  * @send_event: %TRUE if the event was sent explicitly.
  * @context: the #GdkDragContext for the current DND operation.
index 2404daed385ecc9514da9188654a61fba11b28fd..97fc36abde30950d108bfe1060281cca868b8e56 100644 (file)
@@ -5489,9 +5489,7 @@ _gdk_make_event (GdkWindow    *window,
     case GDK_DRAG_ENTER:
     case GDK_DRAG_LEAVE:
     case GDK_DRAG_MOTION:
-    case GDK_DRAG_STATUS:
     case GDK_DROP_START:
-    case GDK_DROP_FINISHED:
       event->dnd.time = the_time;
       break;
 
index 58453cf8c833411edb7d05f7474cde36f558fc11..5540e2eec766176bf041a78bfd0a849b37bd957b 100644 (file)
@@ -107,9 +107,7 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
     case GDK_DRAG_ENTER:
     case GDK_DRAG_LEAVE:
     case GDK_DRAG_MOTION:
-    case GDK_DRAG_STATUS:
     case GDK_DROP_START:
-    case GDK_DROP_FINISHED:
       break;
     default:
       return;
@@ -191,7 +189,6 @@ gdk_wayland_drag_context_drag_motion (GdkDragContext *context,
     {
       context->dest_window = dest_window ? g_object_ref (dest_window) : NULL;
       _gdk_wayland_drag_context_set_coords (context, x_root, y_root);
-      _gdk_wayland_drag_context_emit_event (context, GDK_DRAG_STATUS, time);
     }
 
   gdk_wayland_drag_context_set_action (context, suggested_action);
index 9406d3aac29fb58097d626265cc7eaab97916945..706f124fe93218036a63ebb59563ddd2beeab33c 100644 (file)
@@ -1067,13 +1067,6 @@ xdnd_status_filter (GdkXEvent *xev,
       if (context_x11->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
         context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
 
-      event->any.send_event = FALSE;
-      event->any.type = GDK_DRAG_STATUS;
-      event->dnd.context = context;
-      gdk_event_set_device (event, gdk_drag_context_get_device (context));
-      g_object_ref (context);
-
-      event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
       if (!(action != 0) != !(flags & 1))
         {
           GDK_NOTE (DND,
@@ -1083,7 +1076,11 @@ xdnd_status_filter (GdkXEvent *xev,
 
       context->action = xdnd_action_from_atom (display, action);
 
-      return GDK_FILTER_TRANSLATE;
+      if (context->action != context_x11->current_action)
+        {
+          context_x11->current_action = action;
+          g_signal_emit_by_name (context, "action-changed", action);
+        }
     }
 
   return GDK_FILTER_REMOVE;
@@ -1112,18 +1109,16 @@ xdnd_finished_filter (GdkXEvent *xev,
 
   if (context)
     {
+      g_object_ref (context);
+
       context_x11 = GDK_X11_DRAG_CONTEXT (context);
       if (context_x11->version == 5)
         context_x11->drop_failed = xevent->xclient.data.l[1] == 0;
 
-      event->any.type = GDK_DROP_FINISHED;
-      event->dnd.context = context;
-      gdk_event_set_device (event, gdk_drag_context_get_device (context));
-      g_object_ref (context);
-
-      event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
+      g_signal_emit_by_name (context, "dnd-finished");
+      gdk_drag_drop_done (context, !context_x11->drop_failed);
 
-      return GDK_FILTER_TRANSLATE;
+      g_object_unref (context);
     }
 
   return GDK_FILTER_REMOVE;
@@ -1218,25 +1213,17 @@ send_client_message_async_cb (Window   window,
       context->dest_window &&
       window == GDK_WINDOW_XID (context->dest_window))
     {
-      GdkEvent *temp_event;
       GdkX11DragContext *context_x11 = data;
 
       g_object_unref (context->dest_window);
       context->dest_window = NULL;
       context->action = 0;
-
+      if (context->action != context_x11->current_action)
+        {
+          context_x11->current_action = 0;
+          g_signal_emit_by_name (context, "action-changed", 0);
+        }
       context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
-
-      temp_event = gdk_event_new (GDK_DRAG_STATUS);
-      temp_event->any.window = g_object_ref (context->source_window);
-      temp_event->any.send_event = TRUE;
-      temp_event->dnd.context = g_object_ref (context);
-      temp_event->dnd.time = GDK_CURRENT_TIME;
-      gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
-
-      gdk_display_put_event (gdk_drag_context_get_display (context), temp_event);
-
-      g_object_unref (temp_event);
     }
 
   g_object_unref (context);
@@ -2282,8 +2269,6 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
 
   if (context->dest_window != dest_window)
     {
-      GdkEvent *temp_event;
-
       /* Send a leave to the last destination */
       gdk_drag_do_leave (context_x11, time);
       context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
@@ -2327,19 +2312,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
       /* Push a status event, to let the client know that
        * the drag changed
        */
-      temp_event = gdk_event_new (GDK_DRAG_STATUS);
-      temp_event->any.window = g_object_ref (context->source_window);
-      /* We use this to signal a synthetic status. Perhaps
-       * we should use an extra field...
-       */
-      temp_event->any.send_event = TRUE;
-
-      temp_event->dnd.context = g_object_ref (context);
-      temp_event->dnd.time = time;
-      gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
-
-      gdk_display_put_event (gdk_drag_context_get_display (context), temp_event);
-      g_object_unref (temp_event);
+      if (context->action != context_x11->current_action)
+        {
+          context_x11->current_action = context->action;
+          g_signal_emit_by_name (context, "action-changed", context->action);
+        }
     }
   else
     {
@@ -2366,7 +2343,6 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
 
             case GDK_DRAG_PROTO_ROOTWIN:
               {
-                GdkEvent *temp_event;
                 /* GTK+ traditionally has used application/x-rootwin-drop,
                  * but the XDND spec specifies x-rootwindow-drop.
                  */
@@ -2376,15 +2352,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
                 else
                   context->action = 0;
 
-                temp_event = gdk_event_new (GDK_DRAG_STATUS);
-                temp_event->any.window = g_object_ref (context->source_window);
-                temp_event->any.send_event = FALSE;
-                temp_event->dnd.context = g_object_ref (context);
-                temp_event->dnd.time = time;
-                gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
-
-                gdk_display_put_event (gdk_drag_context_get_display (context), temp_event);
-                g_object_unref (temp_event);
+                if (context->action != context_x11->current_action)
+                  {
+                    context_x11->current_action = context->action;
+                    g_signal_emit_by_name (context, "action-changed", context->action);
+                  }
               }
               break;
             case GDK_DRAG_PROTO_MOTIF:
@@ -3294,41 +3266,6 @@ gdk_dnd_handle_button_event (GdkDragContext       *context,
   return TRUE;
 }
 
-static gboolean
-gdk_dnd_handle_drag_status (GdkDragContext    *context,
-                            const GdkEventDND *event)
-{
-  GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
-  GdkDragAction action;
-
-  if (context != event->context)
-    return FALSE;
-
-  action = gdk_drag_context_get_selected_action (context);
-
-  if (action != context_x11->current_action)
-    {
-      context_x11->current_action = action;
-      g_signal_emit_by_name (context, "action-changed", action);
-    }
-
-  return TRUE;
-}
-
-static gboolean
-gdk_dnd_handle_drop_finished (GdkDragContext *context,
-                              const GdkEventDND *event)
-{
-  GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
-
-  if (context != event->context)
-    return FALSE;
-
-  g_signal_emit_by_name (context, "dnd-finished");
-  gdk_drag_drop_done (context, !x11_context->drop_failed);
-  return TRUE;
-}
-
 gboolean
 gdk_x11_drag_context_handle_event (GdkDragContext *context,
                                    const GdkEvent *event)
@@ -3337,7 +3274,7 @@ gdk_x11_drag_context_handle_event (GdkDragContext *context,
 
   if (!context->is_source)
     return FALSE;
-  if (!x11_context->grab_seat && event->any.type != GDK_DROP_FINISHED)
+  if (!x11_context->grab_seat)
     return FALSE;
 
   switch ((guint) event->any.type)
@@ -3351,10 +3288,6 @@ gdk_x11_drag_context_handle_event (GdkDragContext *context,
       return gdk_dnd_handle_key_event (context, &event->key);
     case GDK_GRAB_BROKEN:
       return gdk_dnd_handle_grab_broken_event (context, &event->grab_broken);
-    case GDK_DRAG_STATUS:
-      return gdk_dnd_handle_drag_status (context, &event->dnd);
-    case GDK_DROP_FINISHED:
-      return gdk_dnd_handle_drop_finished (context, &event->dnd);
     default:
       break;
     }
index e1277863237bf8b8d6505ba9b53f1cbb8e680638..73f4c179ad6d94b90e6d4427e1adb0a481dcba19 100644 (file)
@@ -1874,9 +1874,6 @@ gtk_main_do_event (GdkEvent *event)
       /* Crossing event propagation happens during picking */
       break;
 
-    case GDK_DRAG_STATUS:
-    case GDK_DROP_FINISHED:
-      break;
     case GDK_DRAG_ENTER:
     case GDK_DRAG_LEAVE:
     case GDK_DRAG_MOTION:
index 174b64afcfbbd4ee772896dc8fccedef0725c449..efe230b1b3487555e95f93dd20f44a72153fd5f7 100644 (file)
@@ -6551,9 +6551,7 @@ gtk_widget_emit_event_signals (GtkWidget      *widget,
         case GDK_DRAG_ENTER:
         case GDK_DRAG_LEAVE:
         case GDK_DRAG_MOTION:
-        case GDK_DRAG_STATUS:
         case GDK_DROP_START:
-        case GDK_DROP_FINISHED:
         case GDK_EVENT_LAST:
         case GDK_TOUCHPAD_SWIPE:
         case GDK_TOUCHPAD_PINCH: